home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 001 / tekemul.arc / TEKEMUL.DOC < prev   
Text File  |  1984-09-19  |  17KB  |  442 lines

  1.  
  2. 1
  3. :
  4. $**$ MARGIN=.6
  5.  
  6.  
  7.                  RUNNING MTS GRAPHICS PROGRAMS ON THE IBM PC
  8.  
  9.   1. Introduction
  10.  
  11.      This  document  describes how graphics programs (e.g. *PLOTSEE)
  12.   that produce graphics on a TEKTRONIX 4010 series terminal  may  be
  13.   run on an IBM PC with output on an attached graphics monitor. This
  14.   is achieved by use of TEKTRONIX 4010 terminal  emulation  software
  15.   (TEKEMUL)  running  on  the PC. This program communicates with MTS
  16.   and causes the TEKTRONIX ASCII codes from MTS  to  be  interpreted
  17.   and displayed on the monitor. Thus a user needs a graphics monitor
  18.   in order to use the system. TEKEMUL is written in complied  BASIC.
  19.   The structured nature (as much as BASIC permits) of the program is
  20.   intended to allow it to be adapted to other micro-computers in the
  21.   future.
  22.  
  23.   2. Using TEKEMUL to Output MTS Graphics on the PC
  24.  
  25.      Here  we  assume  that  the  user  has  some  familiarity  with
  26.   operating the IBM PC. The  emulation  program  displays  graphical
  27.   information  in the high resolution mode of the computer. Thus the
  28.   IBM colour/graphics monitor card and a graphics  monitor  must  be
  29.   attached  to  the  IBM  PC  in order that the facility can work as
  30.   intended.
  31.  
  32.      Upon inserting the disk containing TEKEMUL into the disk  drive
  33.   one  merely  types  in  "TEKEMUL".  This  command loads and begins
  34.   executing the emulator program.
  35.  
  36.      The program is of an interactive nature making it quite easy to
  37.   use. The following describes the use of the TEKEMUL program:
  38.  
  39.      a)  A general instruction menu is displayed. This explains some
  40.      of the operational details on how the program is  to  be  used.
  41.      Pressing any key allows one to continue on.
  42.  
  43.      b)  A  communication set-up menu is then displayed. The default
  44.      parameter values for baud rate, parity, data size,  and  number
  45.      of stop bits is displayed in bold face. It is up to the user to
  46.      ensure that the communication  parameters  are  correct  before
  47.      continuing.  For  example,  he should insure that the baud rate
  48.      given to the program is the same as the baud rate of  the  line
  49.      that communicates with MTS.
  50.  
  51.      Changing  the  communication  parameters  is a simple matter of
  52.      entering the new value of the parameter in  place  of  the  old
  53.      value.  If  all of the parameters are correct the user enters a
  54.      "Y" to indicate that the parameters displayed are correct.  The
  55.      message  "Time  to  flick  your  data  set now..." is displayed
  56.      momentarily and then the screen is cleared. It is at this point
  57.      that the user initiates the connection with MTS.
  58. 1
  59.  
  60.  
  61.  
  62.      c)  The  standard  MTS header should be displayed at this time.
  63.      When prompted for terminal-id, you should respond with "T4010".
  64.      This  signifies  to  MTS  that you have a Tektronix 4010 series
  65.      terminal. You can now sign onto MTS in the usual manner.
  66.  
  67.      d) TEKEMUL at this point in time is emulating a  simple  "dumb"
  68.      terminal;  it  is  not  emulating  the Tektronix 4010. Thus any
  69.      attempt to run a graphics program will yield erroneous results.
  70.  
  71.      The Tektronix emulation phase is initiated by  pressing  F9  on
  72.      the keyboard.
  73.  
  74.      e)  Pressing F9 yields another menu which asks you what type of
  75.      display monitor(s) you have. Enter "a", "b", or "c".  And  asks
  76.      whether  you want to use *IG or *PLOTSEE. Enter "c" or "d". And
  77.      finally it prompts you f▀r the object module that will generate
  78. Ü     the  graphics.  You  may press the enter key if you are running
  79.      *PLOTSEE.
  80.  
  81.      f) The program then switches to the color monitor (if  you  are
  82.      not already on it) and issues the MTS RUN command in the form:
  83.  
  84.            $RUN -LOAD#+*IG
  85.  
  86.                or
  87.  
  88.            $RUN *PLOTSEE
  89.  
  90.      depending  on  which  of  the two facilities you selected. When
  91.      your  graphics  program  has  completed  running  you  will  be
  92.      returned to MTS.
  93.  
  94.   3. Running More Than One Graphics Program
  95.  
  96.      Once  you  have  been<eke>  returned to MTS you can run another
  97.   graphics program in one of two ways. You can (a) issue an MTS $RUN
  98.   command directly or (b) press F9 once again.
  99.  
  100.      The  MTS  $RUN  command will work directly since you previously
  101.   pressed F9. Remember that F9 places  you  in  Tektronix  emulation
  102.   mode  and onto the color monitor. Thus any graphics codes intended
  103.   for a Tektronix 4010 will be interpreted and executed by TEKEMUL.
  104.  
  105.   You may also press F9 again to continue having graphical  programs
  106.   run.
  107.  
  108.   4. Exiting the Emulator and the Color Monitor
  109.  
  110.      Pressing  F8  on  the  keyboard  will  transfer you back to the
  111.   monochrome monitor ( if your system has one ). It will  also  take
  112.   you out of Tektronix emulation mode but will leave you on MTS.
  113.  
  114. 1
  115.  
  116.  
  117.  
  118.  
  119.   5. Exit to DOS
  120.  
  121.      Pressing  the  F10  function  key  will  cause  the  program to
  122.   transfer control back to the monochrome monitor ( if  your  system
  123.   has  one  )  and will end the TEKEMUL program, leaving you back in
  124.   DOS. It will not explictly sign you off MTS. You must either  sign
  125.   off yourself or disconnect the line.
  126.  
  127.   6. System Overview
  128.  
  129.      TEKEMUL  accepts  Tektronix  4010 codes and plots the graphical
  130.   information represented by these on the color  monitor.  Figure  1
  131.   illustrates how the system works.
  132.  
  133.  
  134.  
  135.         --------------------
  136.         | Graphics Program |
  137.    MTS  |        |         |
  138.         |  Tektronix 4010  |
  139.         |       codes      |
  140.         --------------------
  141.                  |
  142.            Communication
  143.                 line
  144.                  |
  145.         ------------------------------
  146.         |           TEKEMUL          |
  147.         |              |             |          -----------
  148.    IBM  |   ----------------------   |          |  Color  |
  149.    PC   |   |                     |  |----------| Monitor |
  150.         |  Communication  Tektronix  |          -----------
  151.         |     Program        Code    |
  152.         |                Interpreter |
  153.         ------------------------------
  154.  
  155.   Figure 1 - System Diagram
  156.  
  157.      To get MTS graphics on the PC color monitor, we  have  to  have
  158.   two  programs running; one is the graphics program on the MTS side
  159.   and the other is TEKEMUL in the PC. The latter allows the user  to
  160.   connect  and sign on to MTS. At this stage no graphics is done yet
  161.   and the PC simply acts as a regular  terminal  with  the  help  of
  162.   TEKEMUL.  Once  signed on the user can run the graphics program on
  163.   MTS (such as *IG or *PLOTSEE) that generates  the  Tektronix  4010
  164.   codes.
  165.  
  166.      As MTS sends out the Tektronix 4010 codes, the emulator program
  167.   on the IBM PC interprets the information and produces a picture on
  168.   the monitor.
  169.  
  170. 1
  171.  
  172.  
  173.   6.1 General System Information
  174.  
  175.      The  information  passed  to the Tektronix emulation program is
  176.   the same as that which would be passed to a Tektronix 4010  series
  177.   terminal.
  178.  
  179.      Plotting  of graphical information on the IBM PC is done in the
  180.   high resolution mode of the BASIC compiler. Thus a  color  monitor
  181.   hooked up to the IBM color monitor adapter must be used.
  182.  
  183.      The  resolution  of  high  resolution mode on the IBM PC is 640
  184.   horizontal pixels by 200 vertical. Thus TEKEMUL performs a mapping
  185.   from  the  Tektronix  coordinate  space (1024 x 780) to the IBM PC
  186.   coordinate space.
  187.  
  188.   7. TEKEMUL Details
  189.  
  190.      The code for this  program  has  been  largely  separated  into
  191.   subroutines  and  function  key  and  communication trap routines.
  192.   Figure 2 shows the program flow.
  193.  
  194.  
  195.  
  196.             Define and initialize
  197.             global variables
  198.                      |
  199.             Go to subroutine
  200.             Set up screen  border
  201.                      |
  202.             Print out general
  203.             instruction menu
  204.                      |
  205.             Wait for keyboard input
  206.                      |
  207.             Go to subroutine:
  208.             clear out body of menu
  209.                      |
  210.             Print out communication
  211.             parameter  menu
  212.                      |
  213.             Set  up  communications.
  214.             Initialize communications
  215.             and F8 F9 and F10  trap  routines.
  216.                      |
  217.                      |
  218.    ------>-----------|
  219.    |                 |
  220.    |                 |
  221.    |                 |
  222.    ------<--------Keyboard input ?
  223.    |                 |
  224.    |     No          |    Yes
  225.    |                 |
  226.    -------<------- Send input to MTS
  227.  
  228.   Figure 2 - TEKEMUL program flow
  229.  
  230. 1
  231.  
  232.  
  233.      The program follows the sequence of events outlined  in  Figure
  234.   2.  The last loop is one that the program constantly executes when
  235.   it has nothing to do: reading input from the keyboard and  if  any
  236.   input exists, transmitting it to the host.
  237.  
  238.      All  other  functions  of  the program are accomplished through
  239.   trap  (interrupt)  routines.  When  a  trap  routine  is  finished
  240.   executing,  control is once again returned to the keyboard reading
  241.   loop.
  242.  
  243.   7.1 Subroutine and Trap Routines
  244.  
  245.      There are three trap routines in this program. One of  them  is
  246.   for  the  communications buffer; the other three for function keys
  247.   F8, F9 and F10.
  248.  
  249.      Any information received from  the  host  causes  an  interrupt
  250.   situation and control is passed to the communication trap routine.
  251.   The structure diagram for this routine is in Figure 3.
  252.  
  253.  
  254.                      Communication        YES
  255.     ---------------> buffer empty? ----------------> Return
  256.     |                      |
  257.     |                      |
  258.     |                      |  NO
  259.     |                      |
  260.     |               Get a character
  261.     |                      |
  262.     |               Are we in Tektronix
  263.     |               emulation mode?
  264.     |                   |  |
  265.     |                   |  |
  266.     |       -----<---------------->-------
  267.     |       |                            |
  268.     |       |                            |
  269.     |   Go to Tektronix            perform ordinary
  270.     |   simulation                 terminal functions based
  271.     |   subroutines                on characters received
  272.     |       |                            |
  273.     |       ----->-----------------<------
  274.     |                      |
  275.     |                      |
  276.     -----------<------------
  277.  
  278.   Figure 3 - Communication Trap Routine
  279.  
  280. 1
  281.  
  282.  
  283.      The communication trap routine  processes  characters  received
  284.   from  MTS one at a time until the IBM PC's communication buffer is
  285.   empty. If the program is in  Tektronix  emulation  mode  then  the
  286.   character is passed to the subroutines that actually simulates the
  287.   Tektronix 4010.
  288.  
  289.      If the program is not in  Tektronix  emulation  mode  then  the
  290.   character  is  merely  printed  on  the  screen.  The routine then
  291.   carries on to deal with the next character.
  292.  
  293.      The other three trap routines are executed depending on whether
  294.   F8  F9  or  F10  is  pressed  on the keyboard. The F8 trap routine
  295.   allows the user to stay signed onto MTS, with the  output  of  the
  296.   screen  going to the monochrome screen ( if one is attached ). The
  297.   advantage is that most people prefer to use the monochrome monitor
  298.   for  viewing  text  as  opposed to the colour monitor. The F9 trap
  299.   routine begins the Tektronix emulation mode, switches the user  to
  300.   the  color  monitor and issues various instruction menus. Figure 4
  301.   shows the program flow for this routine.
  302.  
  303.  
  304.            Set up instruction menu
  305.                        |
  306.            Prompt for monitor types
  307.                        |
  308.                        |                       NO
  309.            Does user have  colour  monitor  -------->stop
  310.                        |
  311.                       YES
  312.                        |
  313.            Prompt for graphics software
  314.            to use (*IG or  *PLOTSEE)
  315.                        |
  316.            Prompt  for  user's  object module
  317.                        |
  318.            Switch  to  colour monitor
  319.                        |
  320.            Enable Tektronix emulation mode
  321.                        |
  322.            Send $RUN command to MTS
  323.                        |
  324.                      Return
  325.  
  326.  
  327.            Figure 4 - F9 Trap Routine
  328.  
  329. 1
  330.  
  331.  
  332.      The F10 trap routine ends Tektronix emulation mode and switches
  333.   the  user  back  to  the monochrome monitor (if there is one). The
  334.   diagram for this routine is in Figure 5.
  335.  
  336.            Disable Tektronix emulation mode
  337.                            |
  338.            Switch to monochrome monitor if
  339.                      there is one
  340.                            |
  341.                       Exit to DOS
  342.  
  343.  
  344.                Figure 5 - F10 Trap Routine
  345.  
  346.  
  347.      The  subroutines  that actually simulate the Tektronix 4010 are
  348.   comprised of TEKSIM, ESCAPE-TRUE and ESCAPE-FALSE.
  349.  
  350.      TEKSIM is called from the communications trap routine. Here the
  351.   current character from the communications buffer is placed in BYTE
  352.   as an ASCII decimal value. If the previous charactor was an escape
  353.   character ESCAPE-TRUE is called; else, ESCAPE-FALSE is called.
  354.  
  355.      ESCAPE-TRUE  simulates  the  various  functions  of  the escape
  356.   sequences for the Tektronix 4010.
  357.  
  358.      ESCAPE-FALSE checks to  see  if  the  current  character  is  a
  359.   control  character  or  not. If it is a control character then the
  360.   appropriate control function for the Tektronix 4010 is simulated.
  361.  
  362.      Characters other than control characters are decoded  into  X,Y
  363.   coordinates.  When a complete (X,Y) address is decoded then a move
  364.   or  a  draw  is  made  to  that  coordinate  address.  A  draw  is
  365.   accomplished  by using the BASIC subroutine LINE to draw a line on
  366.   the screen.
  367.  
  368.   7.2 Global Variables
  369.  
  370.      Global variables  important  to  the  simulation  part  of  the
  371.   program are described below.
  372.  
  373.   TEKAMUL:  a  flag  indicating  whether the program is in Tektronix
  374.   emulation mode (TEKEMUL=1) or isn't (TEKEMUL=0).
  375.  
  376.   MODE: indicates if we are in graph mode  (MODE=0)  or  alpha  mode
  377.   (MODE=1) of the Tektronix 4010 terminal.
  378.  
  379.   DARK:  this flag, when set to TRUE, indicates that the next vector
  380.   drawn is to be a dark vector. DARK  is  set  to  TRUE  when  a  GS
  381.   control character is encountered.
  382. 1
  383.  
  384.   7.3 Adaptability to other Micros
  385.  
  386.      TEKEMUL has been structured so that it may easily be adapted to
  387.   other micro  computers.  Should  the  communications  facility  on
  388.   another  micro  be different than the IBM PC's then one can merely
  389.   use the simulator routines TEKSIM, ESCAPE-TRUE,  and  ESCAPE-FALSE
  390.   from the TEKEMUL program.
  391.  
  392.      All  that  these routines require to function by themselves are
  393.   the global variables defined in the start of  the  program  and  a
  394.   character given to the subroutine TEKSIM.
  395.  
  396.   8. History of the Emulator Program
  397.  
  398.      The original Tektronix emulation project began with a desire to
  399.   preview an MTS graphic Plot Description File (PDF) on the IBM  PC.
  400.   We  decided  to write a program for the IBM PC which would be much
  401.   like *PLOTSEE on MTS, except it would run in the PC.  However,  we
  402.   encountered  some  practical  problems  with this scheme. The most
  403.   serious of these problems was the amount of time required to  plot
  404.   a PDF.
  405.  
  406.      This  time  factor  was  due to the fact that the PDF had to be
  407.   transferred over to the IBM PC in order to be plotted. A  PDF  can
  408.   be  on  the  order  of  800,000  bytes.  Given  this  size  it was
  409.   calculated that many plot files would require several  minutes  to
  410.   be transferred using the file transfer programs.
  411.  
  412.      Another  problem complicating the design approach was that Plot
  413.   description files are in binary format. The file transfer programs
  414.   transfer   binary   information   much   slower   than   character
  415.   information.
  416.  
  417.      One solution to this was to represent vector coordinates  in  a
  418.   more  compact form. This solution led to the Tektronix 4010 method
  419.   of transferring coordinates as efficiently as possible.
  420.  
  421.      We considered  converting  a  plot  description  file's  vector
  422.   coordinates  into  Tektronix  format vector coordinates. This much
  423.   smaller file could then be transferred over  to  the  IBM  PC  (as
  424.   character data) and then plotted.
  425.  
  426.      But  there  was  no  sense  writing  a  conversion  program  to
  427.   translate a PDF into Tektronix  format  vector  coordinates  since
  428.   Integrated  Graphics already has a device driver for the Tektronix
  429.   4010 that generated what was needed. It was desirable to eliminate
  430.   the  file  transfer  step  and have the Tektronix emulator work in
  431.   real time as MTS delivered Tektronix 4010 graphics commands.
  432.  
  433.      The regular Tektronix 4010 device driver can be  used  on  MTS,
  434.   and,  it would be easy for the user to operate. In fact the IBM PC
  435.   would operate just like a Tektronix 4010 from a logical  point  of
  436.   view.
  437. 1
  438.  
  439. 
  440.  
  441.  to operate. In fact the IBM PC
  442.   would operate just like a Tektronix 4010 from a logical  point